<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page isELIgnored="false" %>
<jsp:include page="../../include/top.jsp"/>
<div class="main_body">
    <div class="span9 page_message">
        <section id="contents">
            <ul class="tab-nav nav">
                <li><a href="${BasePath}/base/group/list?${PublicParams}">用户组列表<span
                        class="arrow fa fa-sort-up"></span></a></li>
                <li class="current"><a href="javascript:toAdd()">用户组添加/修改<span class="arrow fa fa-sort-up"></span></a></li>
            </ul>
            <div class="tab-content">
                <div id="tab1" class="tab-pane in tab1">
                    <!-- 表单 -->
                    <form class="form-horizontal" id="myForm" name="myForm" action="${BasePath}/base/group/save"
                          method="post">
                        <input type="hidden" name="groupId" value="${editingGroup.id }"/>
                        <input type="hidden" name="type" value="${type }"/>
                        <input type="hidden" name="itemId" value="${itemId }"/>

                        <div class="form-item cf toggle-name">
                            <label class="item-label">
                                <span class="need_flag">*</span>
                                用户组信息：
                                <span class="check-tips"></span>
                            </label>

                            <div class="controls">
                                <input type="text" class="input-xlarge focused" name="groupName" id="groupName"
                                       value="${editingGroup.name }">
                            </div>
                        </div>
                        <button class="btn submit-btn ajax-post" id="submit" type="button" onclick="submitForm()">确 定</button>
                    </form>
                </div>
            </div>
        </section>
    </div>
</div>
<script type="text/javascript">
    function submitForm() {
        var groupName = $("#groupName").val();
        if (groupName == "") {
            alert("用户组名不能为空！");
            return false;
        }
        $('#myForm').ajaxSubmit(function (data) {
            if (data.errno == 0) {
                layer.msg("操作成功！");
                window.location.href="${BasePath}/base/group/list?${PublicParams}"
            } else {
                layer.msg(data.errdesc, {icon: 5});
            }
        });
    }
</script>
<jsp:include page="../../include/bottom.jsp"/>
